package com.cloud.apigatewayfilter;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;

/**
 * App 里的Bean 用来启动重写的过滤器
 *
 * http://localhost:1101/api-a/hello  返回401错误
 * http://localhost:1101/api-a/hello?accessToken=token：
 * 正确路由到eureka-client的/hello接口，并返回Hello World
 */
@EnableZuulProxy
@SpringCloudApplication
public class ApiGatewayFilterApplication {

	public static void main(String[] args) {
		SpringApplication.run(ApiGatewayFilterApplication.class, args);
	}

    @Bean
    public AccessFilter accessFilter() {
        return new AccessFilter();
    }
}
